package com.nervenets.web.controller.handler.admin.setting;


import com.nervenets.web.annotation.NeedValidation;
import com.nervenets.web.controller.handler.ApiParams;
import com.nervenets.web.redis.domain.global.GlobalRule;
import com.nervenets.web.validation.Type;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

/**
 * Created by joe on 17-3-14.
 */
@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
public class GlobalRuleParams extends ApiParams {
    @NeedValidation(type = Type.URL, description = "用户默认头像")
    private String defaultAvatar = "http://img.zcool.cn/community/01786557e4a6fa0000018c1bf080ca.png";//
    /*@NeedValidation(type = Type.FLOATNUMBER, description = "发行商提现的手续费率")
    private BigDecimal proportionOfIssueWithdraw = BigDecimal.valueOf(0.05);//
    @NeedValidation(type = Type.FLOATNUMBER, description = "市场人员提现的手续费率")
    private BigDecimal proportionOfMarketWithdraw = BigDecimal.valueOf(0.05);//
    @NeedValidation(type = Type.FLOATNUMBER, description = "经销商提现的手续费率")
    private BigDecimal proportionOfDealerWithdraw = BigDecimal.valueOf(0.05);//*/
    @NeedValidation(type = Type.FLOATNUMBER, description = "用户提现的手续费率")
    private BigDecimal proportionOfUserWithdraw = BigDecimal.valueOf(0.05);//
    @NeedValidation(type = Type.FLOATNUMBER, description = "用户奖励金转钱包提现的手续费率")
    private BigDecimal proportionOfReward2Money = BigDecimal.valueOf(0.1);//
    @NeedValidation(type = Type.FLOATNUMBER, description = "直推好友奖励比例，为0时不开启奖励")
    private BigDecimal proportionOfFriends = BigDecimal.valueOf(0.1);//
    @NeedValidation(type = Type.FLOATNUMBER, description = "直推好友父级奖励比例，为0时不开启父级奖励")
    private BigDecimal proportionOfTeam = BigDecimal.valueOf(0.05);//
    @NeedValidation(type = Type.NOTEMPTY, description = "客服电话")
    private String customServiceTel;//
    @NeedValidation(type = Type.NUMBER, description = "认证成功赠送积分")
    private long scoreOfIdAuth = 5000;//
    @NeedValidation(type = Type.FLOATNUMBER, description = "购买成功后的积分奖励倍数")
    private BigDecimal scorePropOfBuy = BigDecimal.valueOf(1);//
    @NeedValidation(type = Type.NUMBER, description = "尾款确认时间（单位：分钟）")
    private int tailConfirmHour = 48 * 60;//
    @NeedValidation(type = Type.NUMBER, description = "订单超时未支付时间（单位：分钟）")
    private int orderExpiredPayTime = 48 * 24 * 60;//

    @NeedValidation(type = Type.NOTEMPTY, description = "发票抬头类型")
    private String invoiceType = "企业单位";//
    @NeedValidation(type = Type.NOTEMPTY, description = "发票抬头")
    private String invoiceCompany = "四川视纪网络科技有限公司";//
    @NeedValidation(type = Type.NOTEMPTY, description = "发票税号")
    private String invoiceNo = "91510105MA6B588J35";//
    @NeedValidation(type = Type.NOTEMPTY, description = "公司收件人地址")
    private String invoiceExAddress = "四川省成都市武候区望江路1号中海广场1306";//
    @NeedValidation(type = Type.NOTEMPTY, description = "公司收件人电话")
    private String invoiceExTel = "02885081413";//
    @NeedValidation(type = Type.NOTEMPTY, description = "公司收件邮编")
    private String invoiceExZipCode = "610000";//

    public GlobalRule toGlobalRule() {
        GlobalRule rule = new GlobalRule();
        rule.setDefaultAvatar(defaultAvatar);
        /*rule.setProportionOfIssueWithdraw(proportionOfIssueWithdraw);
        rule.setProportionOfMarketWithdraw(proportionOfMarketWithdraw);
        rule.setProportionOfDealerWithdraw(proportionOfDealerWithdraw);*/
        rule.setProportionOfUserWithdraw(proportionOfUserWithdraw);
        rule.setProportionOfReward2Money(proportionOfReward2Money);
        rule.setProportionOfFriends(proportionOfFriends);
        rule.setProportionOfTeam(proportionOfTeam);
        rule.setCustomServiceTel(customServiceTel);
        rule.setScoreOfIdAuth(scoreOfIdAuth);
        rule.setTailConfirmHour(tailConfirmHour);
        rule.setOrderExpiredPayTime(orderExpiredPayTime);

        rule.setInvoiceType(invoiceType);
        rule.setInvoiceCompany(invoiceCompany);
        rule.setInvoiceNo(invoiceNo);
        rule.setInvoiceExAddress(invoiceExAddress);
        rule.setInvoiceExTel(invoiceExTel);
        rule.setInvoiceExZipCode(invoiceExZipCode);
        return rule;
    }

}
